from selenium import webdriver
from selenium.webdriver import ActionChains
import time

driver = webdriver.Chrome()
driver.maximize_window()

driver.get("http://beike.zxxk.com/index.html#/")
driver.implicitly_wait(10)
time.sleep(2)

driver.switch_to.frame('frame')
# 登录
driver.find_element_by_id('username').send_keys('15814074095')
driver.find_element_by_name('password').send_keys('wy123456')
driver.find_element_by_id('CommonLogin').submit()
time.sleep(2)

print(driver.title)

driver.find_element_by_class_name('iconxinjian').click()

driver.find_element_by_xpath('//span[@title="切换教材"]').click()
driver.find_element_by_xpath('//div[@class="add"]/p').click()

driver.find_element_by_xpath("//button[contains(text(),'新建文件夹')]").click()

driver.find_element_by_css_selector('.iconfont.iconxinjian').click()

time.sleep(2)
# ActionChains(driver).move_to_element(driver.find_element_by_xpath('//div[@aria-modal="true"]//div[3]/div[@class="ya-dialog-footer"]/button[2]')).click()
driver.find_element_by_xpath('//div[@aria-modal="true"]//div[3]/div[@class="ya-dialog-footer"]/button[2]').click()
# time.sleep(2)
driver.find_element_by_xpath('//a[@class="visible-close"]').click()

time.sleep(2)
driver.close()

